<?php 
namespace Qwadmin\Controller;

class StongController extends ComController
{

	//行政查看全部通过的审批
	public function xlist()
	{
		$type = $_GET['type'];

		if (empty($type)) {
			
			$db = M("look");
										
			$xcount = $db->where(['look'=>3,'type'=>0,'ju'=>0])->count();
			$jcount = $db->where(['look'=>6,'type'=>1,'ju'=>0])->count();
			$gcount = $db->where(['look'=>6,'type'=>2,'ju'=>0])->count();
			// dump($xcount);
			// exit;
			$pagecount = 20;
			$page = new \Think\Page($gcount , $pagecount);
			// $row[] = '';
			$page->parameter = $row; //此处的row是数组，为了传递查询条件
			$page->setConfig('first');
			$page->setConfig('prev','上一页');
			$page->setConfig('next','下一页');
			$page->setConfig('last','尾页');
			$page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
			$show = $page->show();
			$list = $db->where(['look'=>3,'type'=>0,'ju'=>0])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
			$title = '已通过行政物资申请';
			$lei = '1';	
			$this->assign('lei',$lei);
			$this->assign('list',$list);
			$this->assign('xcount',$xcount);
			$this->assign('jcount',$jcount);
			$this->assign('gcount',$gcount);
			$this->assign('page',$show);
			$this->assign('title',$title);
			$this->display();

		}else{
			switch ($type) {
				case '1': //固定资产申购
					$db = M("look");
										
					$gcount = $db->where(['look'=>6,'type'=>2,'ju'=>0])->count();
					$jcount = $db->where(['look'=>6,'type'=>1,'ju'=>0])->count();
					$xcount = $db->where(['look'=>3,'type'=>0,'ju'=>0])->count();
					// dump($count);
					// exit;
					$pagecount = 10;
					$page = new \Think\Page($gcount , $pagecount);
					// $row[] = '';
					$page->parameter = $row; //此处的row是数组，为了传递查询条件
					$page->setConfig('first');
					$page->setConfig('prev','上一页');
					$page->setConfig('next','下一页');
					$page->setConfig('last','尾页');
					$page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
					$show = $page->show();
					$list = $db->where(['look'=>6,'type'=>2,'ju'=>0])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
					$title = '已通过固定资产申购';
					$lei = '2';	
					$this->assign('lei',$lei);
					$this->assign('list',$list);
					$this->assign('gcount',$gcount);
					$this->assign('xcount',$xcount);
					$this->assign('jcount',$jcount);
					$this->assign('page',$show);
					$this->assign('title',$title);
					$this->display();
					break;
				case '3': //急性物资申请
					$db = M("look");
										
					$jcount = $db->where(['look'=>6,'type'=>1,'ju'=>0])->count();
					$gcount = $db->where(['look'=>6,'type'=>2,'ju'=>0])->count();
					$xcount = $db->where(['look'=>3,'type'=>0,'ju'=>0])->count();
					// dump($jcount);
					// dump($gcount);
					// dump($xcount);
					// exit;
					$pagecount = 10;
					$page = new \Think\Page($jcount , $pagecount);
					// $row[] = '';
					$page->parameter = $row; //此处的row是数组，为了传递查询条件
					$page->setConfig('first');
					$page->setConfig('prev','上一页');
					$page->setConfig('next','下一页');
					$page->setConfig('last','尾页');
					$page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
					$show = $page->show();
					$list = $db->where(['look'=>6,'type'=>1,'ju'=>0])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
					$title = '已通过急性物资申请';
					$lei = '3';	
					$this->assign('lei',$lei);
					$this->assign('list',$list);
					$this->assign('gcount',$gcount);
					$this->assign('xcount',$xcount);
					$this->assign('jcount',$jcount);
					$this->assign('page',$show);
					$this->assign('title',$title);
					$this->display();
					break;
				
			}
		}


		
	}








	public function yzong()
	{	
		$db = M("look");
					        // $where = "a_id=".$uid;
		$count = $db->where(['type'=>3,'look'=>6,'ju'=>0])->count();
		$pagecount = 10;
		$page = new \Think\Page($count , $pagecount);
		// $row[] = '';
		$page->parameter = $row; //此处的row是数组，为了传递查询条件
		$page->setConfig('first');
		$page->setConfig('prev','上一页');
		$page->setConfig('next','下一页');
		$page->setConfig('last','尾页');
		$page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
		$show = $page->show();
		$list = $db->where(['type'=>3,'look'=>6,'ju'=>0])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
		$title = '所有已通过月度申请';
		// $lei = 1;
		// $dao = 3;
		$ylist = $db->where(['type'=>3,'look'=>6,'ju'=>0])->select();
		foreach ($ylist as  $v) {
			$coun += $v['zong']; 
		}
					   
					        
		$this->assign('list',$list);
		$this->assign('coun',$coun);
		// $this->assign('dao',$dao);
		// $this->assign('lei',$lei);
		$this->assign('page',$show);
		$this->assign('title',$title);
		$this->display();

	}


	public function yku()
	{	
		$db = M("look");
		// $where = "a_id=".$uid;
		$count = $db->where(array('number'=>array('exp',' >num '),'type'=>3,'look'=>3,'ju'=>0,))->count();
		$pagecount = 9;
		$page = new \Think\Page($count , $pagecount);
					        // $row[] = '';
		$page->parameter = $row; //此处的row是数组，为了传递查询条件
		$page->setConfig('first');
		$page->setConfig('prev','上一页');
		$page->setConfig('next','下一页');
		$page->setConfig('last','尾页');
		$page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
		$show = $page->show();
		$list = $db->where(array('number'=>array('exp',' >num '),'type'=>3,'look'=>3,'ju'=>0))->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
		$title = '所有已通过月度申请';
		// $lei = 1;
		// $dao = 3;
		$ylist = $db->where(array('number'=>array('exp',' >num '),'type'=>3,'look'=>3,'ju'=>0))->select();
		foreach ($ylist as  $v) {
			$coun += $v['zong']; 
		}
					   
					        
		$this->assign('list',$list);
		$this->assign('coun',$coun);
		// $this->assign('dao',$dao);
		// $this->assign('lei',$lei);
		$this->assign('page',$show);
		$this->assign('title',$title);
		$this->display();

	}




	//所有通过派车申请审批
	public function che()
	{
		$db = M("turn");
		// $where = "a_id=".$uid;
		$count = $db->where(['look'=>3,'ju'=>0])->count();
		$pagecount = 9;
		$page = new \Think\Page($count , $pagecount);
					        // $row[] = '';
		$page->parameter = $row; //此处的row是数组，为了传递查询条件
		$page->setConfig('first');
		$page->setConfig('prev','上一页');
		$page->setConfig('next','下一页');
		$page->setConfig('last','尾页');
		$page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
		$show = $page->show();
		$list = $db->where(['look'=>3,'ju'=>0])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
		$title = '已通过市内派车申请信息';

					   
					        
		$this->assign('list',$list);
		// $this->assign('coun',$coun);
		// $this->assign('dao',$dao);
		// $this->assign('lei',$lei);
		$this->assign('page',$show);
		$this->assign('title',$title);
		$this->display();
	}









}